Skip to content

Add support for specifying a custom audit model via the audited options#769

Open
muhammad-usman-anwar wants to merge 3 commits intocollectiveidea:mainfrom
muhammad-usman-anwar:main
Open

Add support for specifying a custom audit model via the audited options#769
muhammad-usman-anwar wants to merge 3 commits intocollectiveidea:mainfrom
muhammad-usman-anwar:main

Conversation

@muhammad-usman-anwar
Copy link

@muhammad-usman-anwar muhammad-usman-anwar commented Jan 25, 2026

This helps with achieving targeted behavior for each audited model. Plus can be used to split the audited data across.

Example Usage

To specify a different audit model for a specific audited model, create a new class that
inherits from Audited::Audit:

class CustomAudit < Audited::Audit
  def some_custom_behavior
    "Hiya!"
  end
end

Then provide the class name in options:

class User < ActiveRecord::Base
  audited class_name: "CustomAudit"
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant